<template>
  <a-modal title="查询某个群时段内的消费记录" style="top: 100px;" :visible="isShow" width="600px" @ok="handleOk" @cancel="handleCancel"
    okText="查询">
    <IForm :formFrame="frame" class="form-container" :formData.sync="form"></IForm>
    <span>总消费 {{info.a / 100}} 元</span></br>
    <span>实付金额 {{info.b / 100}} 元</span></br>
    <span>消耗红包 {{info.c / 100}} 元</span></br>
    <span>消耗积分 {{info.d / 100}} 元</span></br>

    </br></br></br>
    <span></span>
  </a-modal>
</template>
<script>
  import IForm from "@/components/IForm"

  export default {
    components: {
      IForm
    },
    props: {
      isShow: {
        type: Boolean
      }
    },
    computed: {
      frame() {
        return [
          {
            title: '开始时间(始)',
            key: 'created_start_at',
            type: 'date',
            showTime: false,
          },
          {
            title: '结束时间(结束)',
            key: 'created_end_at',
            type: 'date',
            showTime: false,
          },
          {
            title: '群',
            key: 'group_id',
            type: 'select',
            span: 17,
            required: true,
            options: this.adv_list
          },
      
        ]
      }
    },
    data() {
      return {
        form: {
         
        },
        itemTotal: 0,
        info:{
          a: 0,
          b: 0,
          c: 0,
          d: 0,
        },
        adv_list: []
      }
    },
    watch: {

    },
    mounted () {
      this.$http.get('/qy-group').then(res => {
        this.adv_list = res.data.list
        this.adv_list = this.adv_list.map(item => {
          return {
            title: item.chat_name,
            value: item.id
          }
        })
      })
    },
    methods: {
      handleOk() {
        this.$http.post('/qy-order-search', this.form).then(res => {
           this.info = res.data
        })
      },

      handleCancel() {
        this.$emit('hide')
      }
    }
  }
</script>
<style lang="scss" scoped>
  .tips {
    color: gray;
    font-size: 80%;
  }
</style>
